/*
 * Author: ahxgw
 * Created Time:  Thu 14 Apr 2011 11:15:47 PM PDT
 * Description: 
 */
#include "utils.h"

void err_sys(const char *s)
{
    perror(s);
    exit(1);
}

void setNB(int fd)
{
    int opt;
    
    opt = fcntl(fd, F_GETFL);
    if (opt < 0)
        err_sys("get fd error");
    opt |= O_NONBLOCK;
    if (fcntl(fd, F_SETFL, opt) < 0)
        err_sys("set fd error");
}
